<template>
  <div>
    <div>{{ obj.name }}</div>
    <button @click="fun">add</button>
    <div>{{ obj.age }}</div>

    <div ref="demo">{{ message }}</div>
    <div @click="fun1">11111</div>
  </div>

</template>

<script>
export default {
  data () {
    return {
      obj: {
        name: '张珊'

      },
      message: 'hello'

    }
  },
  methods: {
    fun () {
      // this.$set('数据','建','值')
      this.$set(this.obj, 'age', 12)
      // this.obj.age = 12
      console.log(this.obj);
    },
    fun1 () {
      this.$refs.demo.innerHTML = '222'
      // console.log(this.message);
      this.$nextTick(() => {
        this.message = this.$refs.demo.innerHTML
        console.log(this.message);
      })
    }
  }

}
</script>

<style>

</style>
